package org.cerberus.platform.internal.server.jetty;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.mortbay.jetty.Handler;
import org.mortbay.jetty.Request;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.handler.AbstractHandler;

public class JettyTest {

	public static void main(String[] args) throws Exception {
		
		Handler handler=new AbstractHandler(){
			@Override
			public void handle(String arg0, HttpServletRequest request,
					HttpServletResponse response, int arg3) throws IOException,
					ServletException {
		        response.setContentType("application");
		        response.setStatus(HttpServletResponse.SC_OK);
		        ServletOutputStream writer = response.getOutputStream();
		        writer.write("sadf".getBytes());
		        response.flushBuffer();
//		        response.getWriter().println("pid:1;o_class:");
		        ((Request)request).setHandled(true);
			}
		};
		
		Server server = new Server(8081);
		server.addHandler(handler);
		server.start();
		
	}
	
}
